#pragma once

#include <cstring>
#include <string>

using namespace std;

#include "topcvt_cross_platform.hpp"

namespace topcvt
{
    #define STRING_ENCODE_UTF8  	"UTF-8"
    #define STRING_ENCODE_GBK   	"GBK"
    #define STRING_ENCODE_GB2312	"GB2312"
    #define STRING_ENCODE_GB18030	"GB18030"
    #define STRING_ENCODE_UNICODE	"UCS-2LE"

    class TOPCVT_API EncodingUtil
    {
    public:
         static int GetUtf8Length(const char* str);
         static string GBKToUTF8(const std::string& strGBK);
         static string UTF8ToGBK(const std::string& strUTF8);
         static std::string Base64_Encode(unsigned char const* bytes_to_encode, unsigned int in_len);
         static std::string Base64_Decode(std::string const& encoded_string);
         static std::string MD5_Encode(const std::string& source);
    };

};